﻿@model IEnumerable<TravelWeb.Models.Tour>
@{
    ViewBag.Title = "Tour";
}
<h2>
    Tour</h2>
<p>
    @if (User.IsInRole("Manager"))
    {
        @Html.ActionLink("Create New", "Create");
    }
</p>
<table>
    <tr>
        <th>
            Tour Name
        </th>
        <th>
            Adult Price
        </th>
        <th>
            Child Price
        </th>
        <th>
            Start Date
        </th>
        <th>
            End Date
        </th>
        <th>
            Promotion
        </th>
        <th>
            Status
        </th>
        <th>
        </th>
    </tr>
    @foreach (var item in Model)
    {
        if (!item.Status.Equals("Canceled"))
        {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.TourName)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.AdultPrice)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.ChildPrice)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.StartDate)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.EndDate)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Promotion.PromotionName)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Status)
            </td>
            <td>
                @if (User.IsInRole("Manager"))
                {
                    @Html.ActionLink("Approve | ", "Approve", new { id = item.TourID });
                    @Html.ActionLink("Edit | ", "Edit", new { id = item.TourID });
                    @Html.ActionLink("Details | ", "Details", new { id = item.TourID });
                    @Html.ActionLink("Delete | ", "Delete", new { id = item.TourID });
                    <a href="/Schedule/Create?tourID=@item.TourID&promotionID=@item.PromotionID">
                            Create Schedule | </a>
                }
                @if (User.IsInRole("User"))
                {
                    @Html.ActionLink("Details | ", "Details", new { id = item.TourID });
                }
                    <a href="/Schedule/Index?tourID=@item.TourID">
                            View Schedule</a>
            </td>
        </tr>
        }
    }
</table>
